package com.lizk.knowledge.fastdfs;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.csource.common.MyException;
import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient1;
import org.csource.fastdfs.StorageServer;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;


public class UploadFile {
	
	public void upload() throws FileNotFoundException, IOException, MyException{
		String path = Client.class.getClassLoader().getResource("").getFile();
		ClientGlobal.init( path + "fdfs_client.conf");
		TrackerClient tracker = new TrackerClient();
	    TrackerServer trackerServer = tracker.getConnection();
	    StorageServer storageServer = null;
	    StorageClient1 client = new StorageClient1(trackerServer, storageServer); 
	    
	    String [] result = null;
	    String str = null;
	    int i = -1;
	    //result = client.upload_file("D:/迅雷下载/03.李丽莎-闺蜜照高清大图-欧洲杯-54P 混血哥爆操中俄混血极品女神美女 极品黑丝长腿腿模，美臀开档美腿高跟翘起屁股露鲍鱼/李丽莎-闺蜜照高清大图-欧洲杯-54P/李丽莎-闺蜜照高清大图-欧洲杯-54P/000.jpg", "jpg", null);
	    //result = client.upload_appender_file("D:/迅雷下载/03.李丽莎-闺蜜照高清大图-欧洲杯-54P 混血哥爆操中俄混血极品女神美女 极品黑丝长腿腿模，美臀开档美腿高跟翘起屁股露鲍鱼/李丽莎-闺蜜照高清大图-欧洲杯-54P/李丽莎-闺蜜照高清大图-欧洲杯-54P/001.jpg", "jpg", null);
	    //str = client.upload_file1("D:/迅雷下载/03.李丽莎-闺蜜照高清大图-欧洲杯-54P 混血哥爆操中俄混血极品女神美女 极品黑丝长腿腿模，美臀开档美腿高跟翘起屁股露鲍鱼/李丽莎-闺蜜照高清大图-欧洲杯-54P/李丽莎-闺蜜照高清大图-欧洲杯-54P/002.jpg", "jpg", null);

	    //i = client.delete_file1("/group2/M00/00/00/wKgFaljuVciAJa2hAAAc3V-B7kM70.conf");
	    //i = client.delete_file("group2","M00/00/00/wKgBEFjvtcuAcS8ZAGc6d3om-r0825_big.jpg");

	    
	    
	   /* result = client.upload_file("D:/迅雷下载/03.李丽莎-闺蜜照高清大图-欧洲杯-54P 混血哥爆操中俄混血极品女神美女 极品黑丝长腿腿模，美臀开档美腿高跟翘起屁股露鲍鱼/李丽莎-闺蜜照高清大图-欧洲杯-54P/李丽莎-闺蜜照高清大图-欧洲杯-54P/006.jpg", "jpg", null);
	    result = client.upload_file( result[0],result[1], "_200X200", "D:/迅雷下载/03.李丽莎-闺蜜照高清大图-欧洲杯-54P 混血哥爆操中俄混血极品女神美女 极品黑丝长腿腿模，美臀开档美腿高跟翘起屁股露鲍鱼/李丽莎-闺蜜照高清大图-欧洲杯-54P/李丽莎-闺蜜照高清大图-欧洲杯-54P/007.jpg"
	    		, "jpg", null);*/
	    
	    //M00/00/00/wKgBDVjwDTKAFUtCALdvkj8XdcY791m.jpg
	    //i = client.delete_file("group1","M00/00/00/wKgFZ1juVNSAWwqWAAAAaakRCTs.sample");
	    
	    System.out.println(i);
	    if(result!=null){
	    	for(String tmp : result){
		    	System.out.println(tmp);
		    }
	    }
	    
	    System.out.println(str);
	}
}
